home *** CD-ROM | disk | FTP | other *** search
/ Georgia Wildfire Prevention / Georgia Wildfire Prevention.iso / pc / media / dirs / BackUp / Home.dir / 00003_Script_Button Behavior < prev    next >
Text File  |  2002-10-15  |  3KB  |  86 lines

  1. --This behavior flashes a member at a desired rate and also allows it to work as a link to another frame.
  2. --PROPERTIES--
  3. --Hot: The member switched to (hot state).
  4. --FlashSpeed: The speed in which the sprite flashes measured in ticks (1/60th of a sec.)
  5. --WhichFrame: The frame junped to if pushed. Zero keeps the current frame.
  6. --Glowing: Lets the function know if the sprite is hot or cold.
  7. --RollOvr: The member switched to when rolled-over.
  8. --ButtonSound: The sound that will play when clicked. Channel 2 is reserved for short sounds.
  9. --TimeTracker: Times out the seconds between flashes.
  10. --SpNum: The sprite number of the sprite.
  11. --MyNum: The Member's number
  12.  
  13. global Neptune
  14. property Hot, FlashSpeed, WhichFrame, Glowing, RollOvr, ButtonSound, MovieControl, TimeTracker, SpNum, MyNum
  15.  
  16. --Captures the spritenumber.
  17. on new me
  18.   SpNum = me.spritenum
  19.   MyNum=sprite(SpNum).member.number
  20. end
  21.  
  22. --Creates the dialog box for the behavior.
  23. on getpropertydescriptionlist me
  24.   set pList = [#Hot:[#comment: "What is the cast member name for the Hot state?", #format: #string, #default: ""], \
  25.  #RollOvr: [#comment: "Which member would you like to use for the rollover?", #format: #string, #default: ""], \
  26.  #ButtonSound:[#comment: "What sound would you like to play when the button is pressed?",#format:#string,#default:"Click"],\
  27.  #MovieControl: [#comment: "Is this button used to control a movie?",#format: #string,#range: ["Play", "Pause","Stop","Rewind","Fast Forward", "No"],#default:"No"], \
  28.  #FlashSpeed:[#comment:  "How often would you like the member to flash (ticks)?", #format: #integer, #range: [#min: 0, #max: 60], #default: 30], \
  29.  #WhichFrame: [#comment: "Which frame would you like to jump to?", #format:#integer, default: "0"]]
  30.   return plist
  31. end
  32.  
  33. --This toggles the flashing object back  and forth at the desired speed while the mouse is not over it.
  34. --on prepareframe me
  35. --  if FlashSpeed <> 0 then
  36. --    if sprite(SpNum).cursor <> 280 then
  37. --      set TimeTracker = the ticks
  38. --      repeat while the ticks < TimeTracker + FlashSpeed
  39. --      end repeat
  40. --      if Glowing = 0 then
  41. --        sprite(SpNum).membernum = member(Hot).number
  42. --        Glowing = Glowing + 1
  43. --      else
  44. --        sprite(SpNum).membernum = member(MyNum).number
  45. --        Glowing = GLowing - 1
  46. --      end if
  47. --      updateStage
  48. --    end if
  49. --  end if
  50. --end
  51.  
  52. --This is for the rollover.
  53. on mouseenter me
  54.   sprite(SpNum).membernum = member(RollOvr).number
  55.   sprite(SpNum).cursor = 280  
  56.   updateStage  
  57. end
  58. on mouseleave me
  59.   sprite(SpNum).membernum = member(MyNum).number
  60.   sprite(SpNum).cursor = 293 
  61. --  Glowing = 0
  62.   updateStage
  63. end
  64.  
  65. --This goes to another frame and tells the movie what to do. Also plays the sound, if any.
  66. on mousedown me
  67.   if WhichFrame <> 0 then
  68.     go to frame WhichFrame
  69.   else if MovieControl <> "No" then
  70.     sendallsprites (#MovieActionDown, MovieControl)  
  71.   end if
  72.   if  ButtonSound <> "" then
  73.     sound(2).play(member(ButtonSound)) 
  74.   end if
  75.   updatestage
  76. end
  77.  
  78. --This tells a movie what to do
  79. on mouseup me
  80. if MovieControl <> "No" then
  81. sendallsprites (#MovieActionUp, MovieControl)
  82. end if
  83. updatestage
  84. end
  85.  
  86.